# Makefile for gdbm.
#

# Note: RANDOM_HASH causes gdbm to use a random hashing technique
#       to give better results. It requires the random number functions
#       from Lib:Utils. Also note that gdbm files created with RANDOM_HASH
#       are incompatible with those created without it!!

CFLAGS = -DRANDOM_HASH -I$$.arm.clib.Utils

OFILES = O.Bucket O.Dbminit O.Delete O.Falloc O.Fetch O.Findkey O.Global \
         O.Hash O.Seq O.Store O.Gdbmopen O.Gdbmdelete O.Gdbmfetch O.Gdbmseq \
         O.Gdbmstore O.Update O.Gdbmclose O.Gdbmreorg O.Version

LIB = <C$$LibRoot>.GnuDBM.o
HDR = <C$$LibRoot>.GnuDBM.h

LIBS = <C$$LibRoot>.o.Stubs <C$$LibRoot>.Utils.o.Utils

.PHONY: all install clean

all: gdbm

install: gdbm
        Copy Gdbm $(LIB).Gdbm FQ~C~V
        Access $(LIB).Gdbm R
        Copy H.Gdbm $(HDR).Gdbm FQ~C~V
        Copy H.Gdbmerrno $(HDR).Gdbmerrno FQ~C~V

clean:
        Remove JunkDbm
        Remove JunkDb!
        Wipe O.*

clobber: clean
        Remove Gdbm
        Remove Test

Gdbm:   $(OFILES)
        libfile Gdbm -c -f $(OFILES)
        objlib Gdbm -c

Test:   O.Test Gdbm
        Link -o Test O.Test Gdbm $(LIBS)
        Squeeze Test

o.Bucket:       h.gdbm h.extern h.gdbmutils
o.Dbminit:      h.gdbm h.extern h.gdbmutils
o.Delete:       h.gdbm h.extern h.gdbmutils
o.Falloc:       h.gdbm h.extern h.gdbmutils
o.Fetch:        h.gdbm h.extern h.gdbmutils
o.Findkey:      h.gdbm h.extern h.gdbmutils
o.Gdbmclose:    h.gdbm h.extern h.gdbmutils
o.Gdbmdelete:   h.gdbm h.extern h.gdbmerrno h.gdbmutils
o.Gdbmfetch:    h.gdbm h.extern h.gdbmerrno h.gdbmutils
o.Gdbmopen:     h.gdbm h.extern h.gdbmerrno h.gdbmutils
o.Gdbmreorg:    h.gdbm h.extern h.gdbmerrno h.gdbmutils
o.Gdbmseq:      h.gdbm h.extern h.gdbmutils
o.Gdbmstore:    h.gdbm h.extern h.gdbmerrno h.gdbmutils
o.Global:       h.gdbm h.extern h.gdbmerrno h.gdbmutils
o.Hash:         h.gdbm h.extern h.gdbmutils
o.Seq:          h.gdbm h.extern h.gdbmutils
o.Store:        h.gdbm h.extern h.gdbmutils
o.Update:       h.gdbm h.extern h.gdbmutils
